package com.lvmama.pangolin.conf;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import com.lvmama.pangolin.service.ConvertTaskService;
import com.lvmama.pangolin.util.RuleUtil;

@Component
public class MyStartupRunner implements CommandLineRunner{
	/**  
	* @Title：MyStartupRunner.java
	* @Author:zhoutianqi
	* @Description:
	* @Date：2017年2月21日下午7:51:47  
	*/
	@Autowired
	private RuleUtil commonUtil;
	@Autowired
	private ConfigManager configManager;
	@Autowired
	private ConvertTaskService taskService;
	@Override
    public void run(String... args) throws Exception {
        System.out.println(">>>>>>>>>>>>>>>服务启动，加载数据中<<<<<<<<<<<<<");
        //将任务状态为处理中20的全部改为可执行状态5
        taskService.updateRunningStatus();
        //缓存节日信息
        commonUtil.cacheFestivalData();
        //缓存价格校验时间跨度信息
        commonUtil.cacheNormalRuleLevels();
        //缓存价格校验特殊配置
        commonUtil.cacheSuperRuleLevels();
        //缓存Timer项配置信息
        configManager.init("");
        System.out.println(">>>>>>>>>>>>>>>服务启动，数据加载完毕<<<<<<<<<<<<<");
    }
}
